<?php
class News {
	var $id = null;
	var $title = null;
	var $content = null;
	var $visible = 0;
	var $meta_title = null;
	var $meta_desc = null;
	var $meta_keys = null;
	
	function viewAll() {
		$query = "select * from dt_news";
		$data = mysql_query($query);
		return $data;
	}
	
	function selectSingle($id) {
		$query = "select * from dt_news where news_id = '$id'";
		$data = mysql_query($query);
		return $data;
	}
	
	function insert($title, $content, $visible, $meta_title, $meta_desc, $meta_keys, $date) {
		$query = "insert into dt_news (news_title, news_content, news_visible, meta_title, meta_desc, meta_keys, news_date) values ('$title', '$content', '$visible', '$meta_title', '$meta_desc', '$meta_keys', '$date')";
		mysql_query($query);
	}
	
	function update($id, $title, $content, $visible, $meta_title, $meta_desc, $meta_keys) {
		$query = "update dt_news set news_title = '$title', news_content = '$content', news_visible = '$visible', meta_title = '$meta_title', meta_desc = '$meta_desc', meta_keys = '$meta_keys' where news_id = '$id'";
		mysql_query($query);
	}
	
	function delete($id) {
		$query = "delete from dt_news where news_id = '$id'";
		mysql_query($query);
	}
}
?>